/*
 * @Author: jhw
 * @Date: 2025-08-06 13:36:27
 * @LastEditors: jhw
 * @LastEditTime: 2025-08-15 15:42:39
 * @Description:
 */
import type {
  TextProps,
  OptionsProps,
  PicLink,
  Status,
  TypeStatus,
  Material,
  OptionsStatusByIndexPayload,
  SurveyRes,
} from '@/types';

export interface Actions {
  setTextStatus: (textProps: TextProps, text: string) => void;
  setOptionsStatus: (optionProps: OptionsProps) => void;
  removeOptionsStatus: (optionProps: OptionsProps, index: number) => number;
  setPositionStatus: (optionProps: OptionsProps, index: number) => void;
  setSizeStatus: (optionProps: OptionsProps, index: number) => void;
  setPicLinkByIndex: (optionProps: OptionsProps, payload: PicLink) => void;
  setCurrentMaterialCom: (comName: string) => void;
  setTypeStatus: (optionProps: OptionsProps, value: number) => void;
  setNoteDescTypeStatus: (status: TypeStatus, value: number) => void;
  setUse: (optionProps: OptionsProps, value: boolean) => void;
  setOptionsStatusByIndex: (
    optionProps: OptionsProps,
    payload: OptionsStatusByIndexPayload,
  ) => void;
  setSwitchStatus: (optionProps: OptionsProps, value: number) => void;
}

// 仓库状态
export interface MaterialStore extends Actions {
  currentMaterialCom: Material;
  coms: Record<Material, Status>;
  setCurrentSurveyCom: (com: Material) => void;
}

export interface EditorStore extends Actions {
  currentComponentIndex: number;
  questionCount: number;
  coms: Status[];
  addCom: (com: Status) => void;
  insertCom: (com: Status, index: number) => void;
  removeCom: (index: number) => void;
  setCurrentComponentIndex: (index: number) => void;
  resetComs: () => void;
  setComs: (coms: SurveyRes) => void;
}
